package com.example.amap.manager

import android.app.Application
import com.alibaba.android.arouter.launcher.ARouter
import com.example.amap.service.IBusinessService
import com.example.amap.service.ILocationService
import com.example.amap.service.ISearchService
import com.example.amap.service.map.IMapService

object ServiceManager : IBusinessService {

    /**
     * 服务初始化
     */
    fun init(application: Application) {
        ARouter.openDebug()
        ARouter.openLog()
        ARouter.init(application)
        getMapService()?.sdkInit(application)
        getLocationService()?.init()
    }

    override fun getMapService(): IMapService? {
        return ARouter.getInstance().navigation(IMapService::class.java)
    }

    override fun getSearchService(): ISearchService? {
        return ARouter.getInstance().navigation(ISearchService::class.java)
    }

    override fun getLocationService(): ILocationService? {
        return ARouter.getInstance().navigation(ILocationService::class.java)
    }
}